package test.java.com.project;

import java.util.HashMap;
import java.util.Iterator;

public class HashMapDemo {
    public static void main(String[] args){
        HashMap<String,String> mp=new HashMap<String,String>();
        mp.put("name","无敌一号");
        mp.put("age","19");
        mp.put("sex","男");
        System.out.println(mp);
        Iterator<String> it=mp.keySet().iterator();
        while(it.hasNext()){
            Object key=it.next();
            Object val=mp.get(key);
            System.out.println("键名："+key+" 值是："+val);
        }
        System.out.println("包含键名："+mp.containsKey("name1"));
        mp.remove("name");
        System.out.println(mp);
    }
}
